﻿using System;
using System.Collections.Generic;
using ProjScan.Config;
using ProjScan.RecordManager;
using ProjScan.ScanRule;
using ProjScan.ScanRule.Attr;
using ProjScan.Tools;

namespace ProjScan.Modules
{
	// Token: 0x0200030D RID: 781
	internal class GlobalSettingsFixModule : BaseModules<GlobalSettingsFixModule, GlobalSettingsConfig>
	{
		// Token: 0x06001265 RID: 4709 RVA: 0x00056304 File Offset: 0x00054504
		public override void Fix()
		{
			FixLog.Instance.Log(Module.Global_Settings_Fix);
			Singleton<PerformanceMeasurer>.Instance.PushState("GlobalSettingsFix");
			this.Init();
			this.LoadRules(LoadMode.FixModules);
			this.LoadFixers();
			foreach (GlobalRule globalRule in this.globalRules_Fix)
			{
				globalRule.FixRule();
				string fullName = globalRule.GetType().FullName;
				FailedResultManager.Instance.UpdateFailedData(fullName, globalRule.failAssetInfos);
			}
			this.Close();
		}

		// Token: 0x06001266 RID: 4710 RVA: 0x000563B4 File Offset: 0x000545B4
		public override void Init()
		{
			this.ruleAttr = typeof(GlobalEditorSettingRuleAttr);
			this.config = (Singleton<ConfigMgr>.Instance.GetConfig<GlobalSettingsConfig>() as GlobalSettingsConfig);
			bool flag = this.baseRules_Fix == null;
			if (flag)
			{
				this.baseRules_Fix = new List<BaseRule>();
			}
			else
			{
				this.baseRules_Fix.Clear();
			}
			this.recordRules_Fix.Clear();
			this.globalRules_Fix.Clear();
			RecordManagerFactory.Instance.Init();
		}

		// Token: 0x06001267 RID: 4711 RVA: 0x000089F1 File Offset: 0x00006BF1
		public override void Close()
		{
			FailedResultManager.Instance.SaveAll();
			Singleton<PerformanceMeasurer>.Instance.AddExecutionCheckpoint("GlobalFixEnd");
			ScanLog.Instance.LogInfo(Module.Global_Settings_Fix, ScanLog.Stage.s6, "Done.");
		}

		// Token: 0x06001268 RID: 4712 RVA: 0x00056434 File Offset: 0x00054634
		public override void FixSingle(string string_0)
		{
			FixLog.Instance.OpenFixLog(false);
			FixLog.Instance.Log(Module.Global_Settings_Fix);
			Singleton<PerformanceMeasurer>.Instance.PushState("GlobalSettingsFix");
			this.Init();
			this.LoadRules(LoadMode.FixSingle, string_0);
			this.LoadFixers();
			foreach (GlobalRule globalRule in this.globalRules_Fix)
			{
				globalRule.FixRule();
				FailedResultManager.Instance.UpdateFailedData(string_0, globalRule.failAssetInfos);
			}
			FixLog.Instance.CloseFixLog();
			this.Close();
		}
	}
}
